<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="chtml" uri="http://www.szhelper.com/jsp/html"%>
<%@include file="/page/common/public.jspf"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset=utf-8" />
<title>我要融资</title>
<meta name="viewport" content="width=1000, initial-scale=0.9"/>
<link rel="stylesheet" type="text/css" href="${path}/css/base.css"/>
<link rel="stylesheet" type="text/css" href="${path}/css/layout.css"/>
<script type="text/javascript" src="${path}/js/jquery-1.7.2.min.js"></script>
<style type="text/css">
	.a_upfile {
		width: 100px;
		height: 25px;
		line-height:26px;
		position: relative;
		text-align:center;
		overflow: hidden;
		vertical-align: bottom;
		font-size: 14px;
	    font-weight: 700;
	    padding: 7px;
	    border-radius: 2px;
	    display: inline-block;
	    color: #809de2;
	    border: 1px solid #809de2;
	    background-color: #f2f8ff;
	    margin-left: 5px;
	}
	.a_upfile:hover{color:#5f6ac0;background-color:#d5e8ff}
	
	
	
	.upfile {
		position: absolute;
		right: 0;
		top: 0;
		font-size: 100px;
		opacity: 0;
		filter: alpha(opacity = 0);
	}
</style>
</head>
<body bgcolor="#f9f9f9">
<form id="borrowInfo"  action="<%=request.getContextPath()%>/borrowInfo/saveBorrow.htm"  method="POST" enctype="multipart/form-data">
<iframe name="hidden_importfile" id="hidden_importfile" style="display: none;"></iframe>
        <!-- head -->
		<c:import url="../include/top.jsp">
			<c:param name="type" value="wyrz"></c:param>
		</c:import>
    	<!--主体-->
    	
<div class="youarehere">
	<div class="localtion"><a href="${path }/">首页</a> > 我要融资</div>
</div>

    	<div class="wrap f_yh">
         <div class="registeredBox" style="margin-top: 0px;border: 1px solid #DFE0E4;border-top-width: 0">
            	<div class="borrow_list_cont f_yh">
                	<table cellpadding="5" cellspacing="0" width="100%">
                		<tr>
                            <td colspan="2" class="title_bg"><span></span>融资意向信息</td>
                        </tr>
                        <tr>
                        	<td colspan="2" height="10px"></td>
                        </tr>
                        <tr>
                        	<td align="right" class="tAlign_r"><span style="color: red;">*</span>借款用途：</td>
                            <td width="100%">
                            
                            		<input type="hidden" name="borrowUserId" value="${user.id }"/>
                            		<input type="text" class="input" id="userFor" name="userFor" value="" />
                            	
                            </td>
                        </tr>
                        <tr>
                        	<td align="right" nowrap class="tAlign_r">是否能提供抵押物：</td>
                            <td>
                            	
                            		<select name="hasmortgage" class="input" style="width:20%;line-height: 36px;">
                            			<option value="YES">能提供</option>
                            			<option value="NO">无法提供</option>
                            		</select>
                            
                            </td>
                        </tr>
                        <tr>
                        	<td align="right" class="tAlign_r"><span style="color: red;">*</span>借款金额：</td>
                            <td>
                            
                            	<input type="text" class="input" name="borrowMoney" id="borrowMoney" value=""  />
                                                元</td>
                        </tr>
                      
                        <tr>
                        	<td align="right" class="tAlign_r"><span style="color: red;">*</span>借款期限：</td>
                            <td>
                            	
                            	<input id="borrowDuration" type="text"  class="input" name="borrowDuration" value="" />&nbsp;
							
								<select name="durType" class="input" style="width:10%">
									<option value="MONTH">月</option>
									<!--  
									<option value="DAY">天</option>
									-->
								</select>
                            </td> 
                        </tr>
                        <tr>
                        	<td align="right" class="tAlign_r">可接受的最大年利率：</td>
                            <td>
                            	<input id="maxBearborrowRate" class="input" type="text"  name="maxBearborrowRate" value="" />%&nbsp;
                            </td> 
                        </tr> 
                       <tr>
                        	<td colspan="2" height="10px"></td>
                        </tr>
                        <tr>
                            <td colspan="2" class="title_bg"><span></span>企业经营信息</td>
                        </tr>
                                                <tr>
                        	<td colspan="2" height="10px"></td>
                        </tr>
                        <tr>
                        	<td align="right" class="tAlign_r">上年度营业额：</td>
                            <td>
                            	<input id="lastyearsell" class="input" type="text"  name="lastyearsell" value="" />&nbsp;
                            </td> 
                        </tr> 
                        <tr>
                        	<td align="right" class="tAlign_r">上年度资产负债率：</td>
                            <td>
                            	<input id="lastyearfzl" class="input" type="text"  name="lastyearfzl" value="" />&nbsp;
                            </td> 
                        </tr> 
                        <tr>
                        	<td align="right" class="tAlign_r">上年度销售成本：</td>
                            <td>
                            	<input id="lastyearsellcb" class="input" type="text"  name="lastyearsellcb" value="" />&nbsp;
                            </td> 
                        </tr>
                        <tr>
                        	<td align="right" class="tAlign_r">上年度净利润：</td>
                            <td>
                            	<input id="lastyearjlr" type="text" class="input" name="lastyearjlr" value="" />&nbsp;
                            </td> 
                        </tr>
                        <tr>
                        	<td align="right" class="tAlign_r">上传企业上年度利润表(上传)：</td>
                            <td>
                            	<input type="hidden" name="profitfilename" id="profitfilename">
                            	<input type="hidden" name="profitfilepath" id="profitfilepath">
                            	<span id="showupfile_profit"></span>
                            	<a href="#" class="a_upfile" id="profit_upfile">
									    点击上传<input class="upfile" type="file" name="profit" id="profit" onchange="importprofit()"/>
								</a>
                            </td> 
                        </tr>
                        <tr>
                        	<td colspan="2" height="10px"></td>
                        </tr>
                        <tr>
                            <td colspan="2" class="title_bg"><span></span>企业工商信息公示栏</td>
                        </tr>
                        <tr>
                        	<td colspan="2" height="10px"></td>
                        </tr>
                        <tr>
                        	<td align="right" class="tAlign_r">营业执照注册号：</td>
                            <td><input id="yyzz" type="text" class="input" name="yyzz" value="" />&nbsp;
                            </td> 
                        </tr>
                        <tr>
                        	<td align="right" class="tAlign_r"><span style="color: red;">*</span>企业法人：</td>
                            <td><input id="qifr" type="text" class="input"  name="qifr" value="" />&nbsp;
                            </td> 
                        </tr>
                        <tr>
                        	<td align="right" nowrap class="tAlign_r">是否有被公示不良记录：</td>
                            <td>
                            		<select name="isunlegal" class="input" style="width:10%">
                            			<option value="YES">有</option>
                            			<option value="NO">没有</option>
                            		</select>
                            </td> 
                        </tr>
                        <tr>
                        	<td align="right" class="tAlign_r">办公地址：</td>
                            <td><input id="businessaddress" class="input" type="text"  name="businessaddress" value="" />&nbsp;
                            </td> 
                        </tr>
                        <tr>
                        	<td align="right" class="tAlign_r"><span style="color: red;">*</span>联系电话：</td>
                            <td><input id="linkmobile"  class="input" type="text"  name="linkmobile" value="" />&nbsp;
                            </td> 
                        </tr>
                        <tr>
                        	<td align="right" nowrap class="tAlign_r"><span style="color: red;">*</span>上传法人身份证：（正面）（反面）：</td>
                            <td>
                            	<input type="hidden" name="idfrontfilename" id="idfrontfilename"/>
                            	<input type="hidden" name="idfrontfilepath" id="idfrontfilepath"/>
                            	<input type="hidden" name="idbackfilename" id="idbackfilename"/>
                            	<input type="hidden" name="idbackfilepath" id="idbackfilepath"/>
	                            <p>
	                            	<span id="showupfile_front"></span>&nbsp;&nbsp;
	                            	<span id="showupfile_back"></span>
	                            </p>
                            	<a href="#" class="a_upfile" id="front_upfile">
									    上传正面<input class="upfile" type="file" name="idfront" id="idfront" onchange="importidfront()"/>
								</a>
                            	<a href="#" class="a_upfile" id="back_upfile">
									    上传反面<input class="upfile" type="file" name="idback" id="idback" onchange="importidback()"/>
								</a>
                            </td> 
                        </tr>
                        <tr>
                        	<td align="right" class="tAlign_r"><span style="color: red;">*</span>上传企业银行开户许可证：</td>
                            <td>
                            	<input type="hidden" name="bankpermitfilename" id="bankpermitfilename">
                            	<input type="hidden" name="bankpermitfilepath" id="bankpermitfilepath">
                            	<span id="showupfile_bankpermit"></span>
                            	<a href="#" class="a_upfile" id="bankpermit_upfile">点击上传<input class="upfile" type="file" name="bankpermit" id="bankpermit" onchange="importbankpermit()"/>
								</a>
                            </td> 
                        </tr>
                        <tr>
                        	<td align="center" class="tAlign_c">&nbsp;</td>
                        	<td align="left" height="66"><input type="button" onclick="tj()" class="bt_ty s_20" style="width: 40%;padding: 15px" value="提 交" /></td>
                       	</tr>
						<tr>
                        	<td colspan="2" height="10px"></td>
                        </tr>
                    </table>
                </div> 
        </div>
        </div>
    	<!--主体-->
    	
    	<!--foot-->
        <c:import url="../include/foot.jsp"></c:import>
        <!--foot--> 
</form>
<script type="text/javascript">
function tj() {
	if ($("#userFor").val() == null || $("#userFor").val() == "") {
		alert("请输入借款用途");
		return;
	}
	if ($("#borrowDuration").val() == null || $("#borrowDuration").val() == "") {
		alert("请输入借款期限");
		return;
	}
	if (isNaN($("#borrowDuration").val())) {
		alert("借款期限必须为数字");
		return;
	}
	var re = /^[1-9]\d*$/;
	if (!re.test($("#borrowDuration").val())) {
        alert("借款期限必须为正整数!");
        return;
    }
	if ($("#linkmobile").val() == null || $("#linkmobile").val() == "") {
		alert("请输入联系电话");
		return;
	}
	if ($("#idfrontfilename").val() == null || $("#idfrontfilename").val() == "") {
		alert("请上传身份证正面");
		return;
	}
	if ($("#idbackfilename").val() == null || $("#idbackfilename").val() == "") {
		alert("请上传身份证反面");
		return;
	}
	if ($("#bankpermitfilename").val() == null || $("#bankpermitfilename").val() == "") {
		alert("上传企业银行开户许可证");
		return;
	}
	if ($("#qifr").val() == null || $("#qifr").val() == "") {
		alert("请输入企业法人");
		return;
	}
	var money = $("#borrowMoney").val();
	if (money == null || money == "") {
		alert("请输入借款金额");
		return;
	}
	if (isNaN(money)) {
		alert("借款金额必须为数字");
		return;
	}
	var re = /^[1-9]\d*$/;
	if (!re.test(money)) {
        alert("借款金额必须为正整数!");
        return;
    }
	$("#borrowInfo").submit();
}
function importidfront() {//上传身份证正面
	$("#idback").remove();
	$("#bankpermit").remove();
	$("#profit_upfile").remove();
  	$("#borrowInfo").attr("action" , "/borrowInfo/importidfront.htm?type=front");
	$("#borrowInfo").attr("target","hidden_importfile");
 	$("#borrowInfo").submit();
}
function importidback() {//上传身份证反面
	$("#idfront").remove();
	$("#bankpermit").remove();
	$("#profit_upfile").remove();
  	$("#borrowInfo").attr("action" , "/borrowInfo/importidback.htm?type=back");
	$("#borrowInfo").attr("target","hidden_importfile");
 	$("#borrowInfo").submit();
}
function importbankpermit() {//上传银行许可证
	$("#idfront").remove();
	$("#idback").remove();
	$("#profit_upfile").remove();
  	$("#borrowInfo").attr("action" , "/borrowInfo/importbankpermit.htm?type=bankpermit");
	$("#borrowInfo").attr("target","hidden_importfile");
 	$("#borrowInfo").submit();
}

function importprofit() {//上传上年度利润报表
	$("#idfront").remove();
	$("#idback").remove();
	$("#bankpermit").remove();
  	$("#borrowInfo").attr("action" , "/borrowInfo/importprofit.htm?type=profit");
	$("#borrowInfo").attr("target","hidden_importfile");
 	$("#borrowInfo").submit();
}
function setshow (filename, path,info, type) {//显示已经上传的文件
	if (info == "success") {
		if (type == "front") {//上传身份证正面
			$("#showupfile_front").append("<a href='"+path+"' target='_blank'>"+filename+"</a></br>");
			
			$("#back_upfile").append('<input class="upfile" type="file" name="idback" id="idback" onchange="importidback()"/>');
			$("#bankpermit_upfile").append('<input class="upfile" type="file" name="bankpermit" id="bankpermit" onchange="importbankpermit()"/>');
			$("#profit_upfile").append('<input class="upfile" type="file" name="profit" id="profit" onchange="importprofit()"/>');
			
			$("#idfrontfilename").val(filename);
			$("#idfrontfilepath").val(path);
		}
		if (type == "back") {//上传身份证背面
			$("#showupfile_back").append("<a href='"+path+"' target='_blank'>"+filename+"</a></br>");
			
			$("#front_upfile").append('<input class="upfile" type="file" name="idfront" id="idfront" onchange="importidfront()"/>');
			$("#bankpermit_upfile").append('<input class="upfile" type="file" name="bankpermit" id="bankpermit" onchange="importbankpermit()"/>');
			$("#profit_upfile").append('<input class="upfile" type="file" name="profit" id="profit" onchange="importprofit()"/>');
			
			$("#idbackfilename").val(filename);
			$("#idbackfilepath").val(path);
		}
		if (type =="bankpermit") {//上传银行开户许可证
			$("#showupfile_bankpermit").append("<a href='"+path+"' target='_blank'>"+filename+"</a></br>");
			
			$("#back_upfile").append('<input class="upfile" type="file" name="idback" id="idback" onchange="importidback()"/>');
			$("#front_upfile").append('<input class="upfile" type="file" name="idfront" id="idfront" onchange="importidfront()"/>');
			$("#profit_upfile").append('<input class="upfile" type="file" name="profit" id="profit" onchange="importprofit()"/>');
			
			$("#bankpermitfilename").val(filename);
			$("#bankpermitfilepath").val(path);
		}
		if (type == "profit") {//上传上年度利润报表
			$("#showupfile_profit").append("<a href='"+path+"' target='_blank'>"+filename+"</a></br>");
			
			$("#back_upfile").append('<input class="upfile" type="file" name="idback" id="idback" onchange="importidback()"/>');
			$("#front_upfile").append('<input class="upfile" type="file" name="idfront" id="idfront" onchange="importidfront()"/>');
			$("#bankpermit_upfile").append('<input class="upfile" type="file" name="bankpermit" id="bankpermit" onchange="importbankpermit()"/>');
			
			$("#profitfilename").val(filename);
			$("#profitfilepath").val(path);
		}
	}
	$("#borrowInfo").attr("action" , "<%=request.getContextPath()%>/borrowInfo/saveBorrow.htm");
	$("#borrowInfo").removeAttr("target");
}
</script>   
</body>
</html>